package entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import consts.GlobalConsts;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

//不返回将空字段null作为json返回
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class User {
    public static final int ROLE_COMMON = 0;
    public static final int ROLE_DATA_ADMIN = 1;
    public static final int ROLE_AUDIT_ADMIN = 2;

    protected String username;
    protected String password;
    protected String name;
    @DateTimeFormat(pattern = GlobalConsts.DATE_FORMAT_PATTERN)
    protected Date admission_date;
    protected Integer role;


    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Date getAdmission_date() {
        return admission_date;
    }

    public void setAdmission_date(Date admission_date) {
        this.admission_date = admission_date;
    }

    public Integer getRole() {
        return role;
    }

    protected void setRole(Integer role) {
        this.role = role;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "User{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", name='" + name + '\'' +
                ", admission_date=" + admission_date +
                ", role=" + role +
                '}';
    }
}
